// 云函数入口文件

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.wxacode.getUnlimited({
      scene: 'form_user_id=z677'
    })
    const upload = await cloud.uploadFile({
      cloudPath: 'qrcode/' + Date.now() + '-' + Math.random() + '.png',
      fileContent: result.buffer
    })
    return upload.fileID
  } catch (err) {
    return err
  }
}